var webdriver = require('selenium-webdriver'),
    By = webdriver.By,
    until = webdriver.until;

var driver = new webdriver.Builder()
    .forBrowser('chrome')
    .build();

const url = 'http://www.bing.com/';
const inputTextBox = "//*[@id=\"sb_form_q\"]";
const searchButton = "//*[@id=\"sb_form_go\"]";
const searchText = 'My Search';
const title = 'Bing';

try {
  driver.get(url);
} catch (err) {
  console.error(err);
}
driver.findElement(By.xpath(inputTextBox)).sendKeys(searchText);
driver.findElement(By.xpath(searchButton)).click();
driver.wait(until.titleContains(searchText), 1000);
driver.quit();
